import { defineComponent } from 'vue';
import { Button } from 'ant-design-vue';
import { createElement } from './createElement';
import { AuditOutlined } from '@ant-design/icons-vue';

const HumanNode = defineComponent({
  name: 'HumanNode',
  setup() {
    const handleCreateUserTask = (e: Event) => {
      createElement(e, 'UserTask','执行节点', { UserTaskType: 'userTask' });
    };
    const getAssetsFile = (fileName: string) => {
      return new URL(`/src/assets/icons/${fileName}`, import.meta.url).href;
    }
    
    return () => (
      <Button
        ghost
        type="primary"
        onClick={handleCreateUserTask}
        draggable="true"
        onDragstart={handleCreateUserTask}
      >
        <span>
          <img 
            src={getAssetsFile('spjd.png')} 
            alt="执行节点图标" 
            style={{ width: '14px', height: '14px', marginRight: '6px' }} 
          />
          执行节点
        </span>
      </Button>
    );
  },
});

export default HumanNode;